import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../style/app_colors.dart';
import '../../../widget/CommonWidgets.dart';
import '../../../widget/tips.dart';
import '../controllers/about_robot_controller.dart';

class AboutRobotView extends GetView<AboutRobotController> {
  const AboutRobotView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.device_page_bg_color,
      appBar: AppBar(
        title: const Text('关于机器人'),
        centerTitle: true,
        leading: IconButton(
          icon: Image.asset('assets/images/ic_back2.png',width: 48.w,height: 48.h),
          onPressed: () {
            Get.back();
          },
          tooltip: MaterialLocalizations.of(context).backButtonTooltip, // 可选：设置工具提示
        ),
      ),
      body: Obx(()=>Column(
        children: [
          Container(
            margin: EdgeInsets.all(40.h),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(16)),
                color: Colors.white
            ),
            child: Column(
              children: [
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('总容量',style: TextStyle(fontSize: 32.sp),),
                      Text('${controller.robotResponse.value.totalspace}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color),)
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(left: 30.w,right: 30.w),
                  child:  CommonWidgets.getMyDivider(),
                ),
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('可用容量',style: TextStyle(fontSize: 32.sp)),
                      Text('${controller.robotResponse.value.availablespace}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color),)
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(left: 30.w,right: 30.w),
                  child:  CommonWidgets.getMyDivider(),
                ),
              ],
            ),
          ),
          SizedBox(width: 40.w),
          Container(
            margin: EdgeInsets.all(40.h),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(16)),
                color: Colors.white
            ),
            child: Column(
              children: [
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('序列号',style: TextStyle(fontSize: 32.sp),),
                      Row(
                        children: [
                          Text('${controller.robotResponse.value.serail}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color)),
                          GestureDetector(
                            onTap: () {
                              Clipboard.setData(ClipboardData(text: controller.robotResponse.value.serail));
                              Tips.showToast('已复制序列号');
                            },
                            child: Image.asset('assets/images/ic_copy.webp',width: 36.w,height: 34.h,),
                          )
                        ],
                      ),
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(left: 30.w,right: 30.w),
                  child: CommonWidgets.getMyDivider(),
                ),
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('系统版本',style: TextStyle(fontSize: 32.sp)),
                      Text('${controller.robotResponse.value.sysversion}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color),)
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(left: 30.w,right: 30.w),
                  child:  CommonWidgets.getMyDivider(),
                ),
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('主服务版本',style: TextStyle(fontSize: 32.sp)),
                      Text('${controller.robotResponse.value.mainappversion}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color),)
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(left: 30.w,right: 30.w),
                  child:  CommonWidgets.getMyDivider(),
                ),
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('固件版本',style: TextStyle(fontSize: 32.sp)),
                      Text('${controller.robotResponse.value.hardwareversion}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color),)
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(left: 30.w,right: 30.w),
                  child:  CommonWidgets.getMyDivider(),
                ),
                Container(
                  padding: EdgeInsets.only(top: 22.h, bottom: 22.h,left: 30.w,right: 30.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text('电池容量',style: TextStyle(fontSize: 32.sp)),
                      Text('${controller.robotResponse.value.batterycapacity}',style: TextStyle(fontSize: 32.sp,color: AppColors.line_right_character_color),)
                    ],
                  ),
                ),

              ],
            ),
          ),
          SizedBox(height: 30.h,),
          Container(
            margin: EdgeInsets.only(left: 68.w, right: 68.w),
            child: Text('为减缓电池老化,延长使用寿命,悟空机器人会智能识别与学习您的充电模式，长时间充电时会暂缓充电至80%以上.',
                style: TextStyle(fontSize: 26.sp,color: AppColors.line_right_character_color)),
          )

        ],
      )),
    );
  }
}
